package cn.yza.Kotlin.test

import java.lang.reflect.Array.get

/**
@author Honglixi
@create 2022-05-30 9:34
 */
var StringBuilder.lastChar: Char
    get() = get(length - 1)
    set(value: Char) {
        this.setCharAt(length - 1, value)
    }
fun main() {
    println("Kotlin".lastChar())

    val stringBuilder = StringBuilder("Kotlin?")
    stringBuilder.lastChar = '!'
    println(stringBuilder)
}